$(function(){
	$('body').on('click', "#loginsubmit", function() {
		var phone=$('#username').val();
		var password=$('#password').val();
		if($('#rememberMe').is(':checked')) { 
			var rememberMe=1;
		}else{
			var rememberMe=0;
		}
		if(phone==''){
			layer.alert('请输入手机号！');
			return;
		}
		if(password==''){
			layer.alert('请输入密码！');
			return;
		}
		
		$.post('/user/login_in', {
			phone: phone,
			password: password,
			rememberMe: rememberMe,
		}, function(result) {
			if(result.code==0){
				layer.alert(result.message)
			}
			if(result.code==1){
				layer.msg(result.message)
				setTimeout('location.href="'+result.data+'";',1000)
			}
		}, "json");
	})
})
